package com.devunion.salon.persistence.dao;

import com.devunion.salon.persistence.Transaction;
import org.hibernate.Hibernate;

import java.io.Serializable;
import java.sql.Date;
import java.util.List;

/**
 * @author Viktar Liaskovich
 */
public class TransactionDao extends BaseDaoObject<Transaction> {
    public Transaction getByKey(Serializable key) {
        return (Transaction) getHibernateTemplate().get(Transaction.class, key);
    }

    /*public List<Transaction> getTransactionsOnDate(Date creationDate) {
        return getSession().createQuery("from Transaction where creationDate = :date").
                setParameter("date", creationDate, Hibernate.DATE).
                list();
    }

    public List<Transaction> getTransactionsOnDate(String username, Date creationDate) {
        return getSession().createQuery("from Transaction transaction, Login login where transaction.creationDate = :date and " +
                "login.login = :username and transaction.location = login.location").
                setParameter("date", creationDate, Hibernate.DATE).
                setParameter("username", username, Hibernate.STRING).
                list();
    }*/
}
